package cn.yyh.serviceOrg.service.impl;

import cn.yyh.commons.service.impl.MyBaseServiceImpl;
import cn.yyh.serviceOrg.entity.SystemDictionaryType;
import cn.yyh.serviceOrg.mapper.SystemDictionaryDetailMapper;
import cn.yyh.serviceOrg.mapper.SystemDictionaryTypeMapper;
import cn.yyh.serviceOrg.service.SystemDictionaryTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author yang
 * @since 2021-07-10
 */
@Service
public class SystemDictionaryTypeServiceImpl extends MyBaseServiceImpl<SystemDictionaryTypeMapper, SystemDictionaryType> implements SystemDictionaryTypeService {
    @Autowired
    private SystemDictionaryDetailMapper detailMapper;

    @Override
    public void delete(Long id) {
        boolean flag = true;
        while (flag) {
            Boolean aBoolean = detailMapper.deleteAll(id);
            if (!aBoolean) {
                super.delete(id);
                flag = false;
            }
        }
    }

    @Override
    public void deleteBatch(List<Long> ids) {
        detailMapper.deleteBatch(ids);

        super.deleteBatch(ids);


    }
}
